package com.bdsy.business.controller;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bdsy.api.annotation.IgnoreAuth;
import com.bdsy.business.service.ShopAuOrderService;

@Controller
@RequestMapping(value = {"${web.adminPath}", "${web.appPath}"})
public class JpShopManager {

	@Autowired
	private ShopAuOrderService shopAuOrderService;
	
	/**
	 * 数量统计
	 */
	@IgnoreAuth
	@ResponseBody
	@RequestMapping(value = "jcountStatis")
	public Object jcountStatis(String userId){
		Map<String,Object> map = new LinkedHashMap<>();
		//在售竞拍物品数量统计 
        int jsellCount= shopAuOrderService.jsellCount(userId);
        //已完成竞拍订单数量
        int jacount = shopAuOrderService.jacount(userId);
        //未完成竞拍订单数量
        int jncount = shopAuOrderService.jncount(userId);
        //销量统计 暂时为空
		map.put("code", 200);
		map.put("msg","success");
		map.put("jsellCount",jsellCount);
		map.put("jacount",jacount);
		map.put("jncount",jncount);
//		map.put("salesCount", "99");
		return map;
	}
	
	
	/**
	 * 当前用户所发布竞拍商品  未/已完成订单 
	 * 
	 *  auOrderStatus  0  1   2  待发货  待收货  已完成  
	 */
	@IgnoreAuth
	@ResponseBody
	@RequestMapping(value = "jnareadyOrderList")
	public Object jnareadyOrderList(int auOrderStatus, String userId, int shopTypeId,int qx){
		Map<String,Object> map = new LinkedHashMap<>();
		List<Map> shopAuOrder = shopAuOrderService.selectAOrNShopAuOrder(auOrderStatus, userId, shopTypeId, qx);
		map.put("code", 200);
		map.put("msg", "success");
		map.put("shopAuOrder", shopAuOrder);
		return map;
	}
	
}
